package com;

import com.lcy.mapper.StudentMapper;
import com.lcy.model.Student;
import com.lcy.mybatis.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/1/17.
 */
public class Demo {
    @Test
    public void ok(){
        SqlSession s = MyBatisUtil.getSqlSession();
        StudentMapper sm = s.getMapper(StudentMapper.class);
        //List<Student> sts = sm.search(null); 查询所有学生信息

        Map<String,Object> m = new HashMap<String,Object>();
        //m.put("name","%a%");
        //m.put("name","%李%");
        m.put("name","辅%");
        m.put("address","%郑州%");
        List<Student> sts = sm.query(m);


        for(Student st : sts){
            System.out.println(st.getName());
        }
        s.commit();
        s.close();
    }
}
